package com.gonsin.gnews.annotations.model;

import com.gonsin.gnews.annotations.GNewsField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.text.SimpleDateFormat;

@ApiModel("时间格式")
@Data
public class TimePo {

    public TimePo(long time){
        this.yyyy = new SimpleDateFormat("yyyy").format(time);
        this.MM = new SimpleDateFormat("MM").format(time);
        this.dd = new SimpleDateFormat("dd").format(time);
        this.HH = new SimpleDateFormat("HH").format(time);
        this.m = new SimpleDateFormat("mm").format(time);
        this.ss = new SimpleDateFormat("ss").format(time);
        this.E = new SimpleDateFormat("E").format(time);
    }

    @GNewsField(name = "年", demo = "2022")
    private String yyyy;

    @GNewsField(name = "月", demo = "10")
    private String MM;

    @GNewsField(name = "日", demo = "20")
    private String dd;

    @GNewsField(name = "时", demo = "16")
    private String HH;

    @GNewsField(name = "分", demo = "30")
    private String m;

    @GNewsField(name = "秒", demo = "00")
    private String ss;

    @ApiModelProperty("星期几")
    private String E;

}

